<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTicketUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mckj_ticket_user', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('名称');
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->integer('give_user_id')->default(0)->comment('赠送方用户id');
            $table->smallInteger('status')->default(1)->comment('状态，1有效，0无效');
            $table->integer('ticket_id')->default(0)->comment('券ID');
            $table->integer('number')->default(0)->comment('次数（-1无限）');
            $table->integer('surplus_number')->default(0)->comment('剩余次数（-1无限）');
            $table->timestamp('expiration_time')->comment('过期时间');
            $table->integer('validity_day')->default(0)->comment('有效期（-1永久）');
            $table->string('image_url')->comment('图片地址');
            $table->text('careful_item')->comment('注意事项');
            $table->text('mcstation_ids')->comment('适用站点（门店ID字符串英文逗号分割）');
            $table->timestamp('created_time')->nullable()->comment('创建时间');
            $table->timestamp('updated_time')->nullable()->comment('更新时间');
            $table->integer('receive_user_id')->default(0)->comment('领取方Id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mckj_ticket_user');
    }
}
